package com.xyht.sca_s.student_manage_system.modules.assetConsumable.controller;


import com.xyht.sca_s.student_manage_system.common.commonReturn.ResponseResult;
import com.xyht.sca_s.student_manage_system.common.desEncodeAndDecode.annotation.SecretBody;
import com.xyht.sca_s.student_manage_system.modules.assetConsumable.entity.req.SmsAssetConsumableStorageManageReq;
import com.xyht.sca_s.student_manage_system.modules.assetConsumable.service.SmsAssetConsumableStorageManageService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 仓库管理表 前端控制器
 * </p>
 *
 * @author XYHT
 * @since 2024-09-22
 */
@RestController
@RequestMapping("/assetConsumable/storageManage")
@SecretBody
public class SmsAssetConsumableStorageManageController {

    @Resource
    private SmsAssetConsumableStorageManageService smsAssetConsumableStorageManageService;

    @ApiOperation("添加仓库")
    @PostMapping("/add")
    public ResponseResult addStorageManage(@RequestBody SmsAssetConsumableStorageManageReq req) {
        return smsAssetConsumableStorageManageService.addStorageManage(req);
    }

    @ApiOperation("修改仓库")
    @PostMapping("/update")
    public ResponseResult updateStorageManage(@RequestBody SmsAssetConsumableStorageManageReq updateReq) {
        return smsAssetConsumableStorageManageService.updateStorageManage(updateReq);
    }


    @ApiOperation("删除仓库")
    @PostMapping("/deleted")
    public ResponseResult deletedStorageManage(@RequestBody SmsAssetConsumableStorageManageReq deleteReq) {
        return smsAssetConsumableStorageManageService.deletedStorageManage(deleteReq);
    }

    @ApiOperation("查看仓库列表")
    @GetMapping("/list")
    public ResponseResult getStorageManageList(@RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
                                               @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                               @RequestParam(value = "storageName",required = false) String storageName) {
        return smsAssetConsumableStorageManageService.getStorageManageList(pageSize,pageNum,storageName);
    }


}

